import React from 'react';
import { Skeleton,Avatar } from 'antd';
import UploadUtil from '@/components/UploadUtil';
import imgAvatar from '@/assets/avatar.png'
import { useModel } from 'umi';
import styles from './index.less';

const PageHeaderContent: React.FC<any> =  () => {  
    const { initialState } = useModel('@@initialState');
    const { currentUser } = initialState || {};
    const loading = currentUser && Object.keys(currentUser).length;
    if (!loading) {
      return <Skeleton avatar paragraph={{ rows: 1 }} active />;
    }
    return (
      <div>
        <Avatar size="large" src={currentUser?.avater ? UploadUtil.imgServ + currentUser?.avater : imgAvatar} />
        <span className={styles.welcomtxt}>你好，{currentUser?.userName}，祝你开心每一天！{currentUser?.emailAddress}</span>
      </div>
    );
  };
export default PageHeaderContent;